$INCLUDE: 'C:\FG\FASTGRAF.FI'

      PROGRAM MAIN

      INTEGER CGA_PATTERNS(0:15)
      INTEGER COLOR
      INTEGER OLD_MODE, NEW_MODE
      INTEGER STATUS
      INTEGER FG_BESTMODE, FG_GETMODE, FG_SHOWPPR

      DATA CGA_PATTERNS /
     +   #0000,#00FF,#00FF,#00FF,#02BB,#0000,#0222,#0255,
     +   #00FF,#00FF,#00FF,#0055,#00AA,#00AA,#00FF,#0277/

      CALL FG_INITPM
      NEW_MODE = FG_BESTMODE(320,200,1)
      IF (NEW_MODE .LT. 0 .OR. NEW_MODE .EQ. 12) THEN
         STOP 'This program requires a 320 x 200 color graphics mode.'
      END IF

      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(NEW_MODE)

      IF (NEW_MODE .EQ. 4) THEN
         CALL FG_PALETTE(0,0)
         DO 10 COLOR = 0,15
            CALL FG_PATTERN(COLOR,CGA_PATTERNS(COLOR))
10       CONTINUE
      ELSE IF (NEW_MODE .EQ. 9 .OR. NEW_MODE .EQ. 13) THEN
         CALL FG_PATTERN(15,#04F7)
      ELSE
         CALL FG_SETRGB(15,38,38,38)
      END IF

      CALL FG_MOVE(0,199)
      STATUS = FG_SHOWPPR('CORAL.PPR'//CHAR(0),320)
      CALL FG_WAITKEY

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
      END
